<template>
  <div>
    <h1>商品详情页面 {{this.$route.params.id}}</h1>
    <button @click="onNext">去子页面</button>
    <router-view/>
  </div>
</template>

<script>
export default {
  name: 'detail',
  created () {
    console.log('detail的参数', this.$route)
  },
  methods: {
    onNext: function () {
      // this.$router.push({
      //   name: 'SubDetail'
      // })
      // this.$emit('change-view', {
      //   name: 'SubDetail'
      // })
      this.$store.commit('changeView', {
        routerParams: {
          name: 'SubDetail',
          params: { }
        }
      })
    }
  }
}
</script>

<style scoped>

</style>
